package cn.js.sangu.unitStore.entity;

import cn.hutool.core.annotation.Alias;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 说明：用户表
 * 作者：linshuo
 * 日期：2024/8/7 9:10
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("user")
public class User {
    @TableId(type = IdType.AUTO)
    private Integer id;
    @Alias("账号") //Hutool工具用于标识字段中文名
    private String username;
    @Alias("密码")
    private String password;
    @Alias("姓名")
    private String name;
    @Alias("手机号")
    private String phone;
    @Alias("邮箱")
    private String email;
    @Alias("地址")
    private String address;
    @Alias("头像")
    private String avatar;
    @Alias("账号状态")
    private Integer state;
    @Alias("电脑状态")
    private Integer computer;
    @Alias("权限")
    private String role;
    @Alias("令牌")
    @TableField(exist = false)
    private String token;

    @Alias("三方账号")
    private String tAccount;
    @Alias("三方密码")
    private String tPwd;
    @Alias("设备名称")
    private String deviceName;

    @Alias("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai")
    private Date creatTime;

    @Alias("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai")
    private Date updateTime;
}
